package com.xijing.dao;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import com.xijing.model.ProduceInfo;
import com.xijing.model.SYS_User;

public class ProduceDAO extends BaseDAO {

	private String columnFiel = "BPI_SPNum,BPI_Name,BPI_Price,BPI_Unit,BPI_Remark";
	/**
	 * 查询获取一个对象列表
	 * @return
	 */
	public List<ProduceInfo> getAdminList(String KeyStr) {
		Connection conn = getConnection();
		QueryRunner qr = new QueryRunner();
		String sql = "SELECT " + columnFiel + " FROM BIZ_ProduceInfo where BPI_Name like '%"+KeyStr+"%'";
		try {
			List<ProduceInfo> list = qr.query(conn, sql, new BeanListHandler<ProduceInfo>(ProduceInfo.class));
			return list;
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		return null;
	}
}
